//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.DataLayer.ServiceModel
{
    using System;

    /// <summary>
    /// Respresents a node in the tree veiw
    /// </summary>
    [Serializable]
    public class NodeModel
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeModel"/> class.
        /// </summary>
        /// <param name="node">The node.</param>
        public NodeModel(Machine node)
        {
            this.NodeId = (node as IObject).ID;
            this.NodeName = node.Name;
            this.IsInteractive = node.IsInteractiveExecution;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NodeModel"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        public NodeModel(string name)
        {
            this.NodeId = Guid.NewGuid();
            this.NodeName = name;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="NodeModel"/> class.
        /// </summary>
        public NodeModel()
        {
        }

        /// <summary>
        /// Gets or sets the node id.
        /// </summary>
        /// <value>The node id.</value>
        public Guid NodeId { get; private set; }

        /// <summary>
        /// Gets or sets the name of the node.
        /// </summary>
        /// <value>The name of the node.</value>
        public string NodeName { get; private set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is interactive.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is interactive; otherwise, <c>false</c>.
        /// </value>
        public bool IsInteractive { get; private set; }
    }
}
